package cn.tedu.csmall.passport.controller;

import cn.tedu.csmall.passport.pojo.vo.AdminListItemVO;
import cn.tedu.csmall.passport.pojo.vo.RoleListItemVO;
import cn.tedu.csmall.passport.service.IRoleService;
import cn.tedu.csmall.passport.web.JsonResult;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 何惠民
 */
@Validated
@Api(tags = "02角色管理模块")
@Slf4j
@RestController
@RequestMapping("/roles")
public class RoleController {
    @Autowired
    IRoleService roleService;

    public RoleController() {
        log.debug("创建控制器对象:RoleController");
    }

    @ApiOperation("查询角色列表")
    @ApiOperationSupport(order = 410)
    @GetMapping("")
    public JsonResult<List<RoleListItemVO>> list(){
        log.debug("开始处理[查询管理员列表]的请求,参数无");
        List<RoleListItemVO> list = roleService.list();
        log.debug("查询管理员列表成功");
        return JsonResult.ok(list);
    }

}
